<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Play extends MY_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->checkUser($this->session->userdata('user_id'));
        $this->data['controller'] = 'play';
        $this->load->model('Mindex');
        $data = array('loadaudio' => 0);
        $this->session->set_userdata($data);
    }
    
    public function index()
    {	
        $this->noteUser();
        $this->data['statusConnect'] = $this->session->userdata('checkstart') ? $this->session->userdata('checkstart') : '';
        $this->data['action'] = 'index';
        $this->load->view('template/layout', $this->data);
    }
	
	private function noteUser()
	{
		$this->session->userdata('user_id');
        
        if(in_array($this->session->userdata('paymentPlay'), array(null, '', '0')))
        {
            $checkCoin = $this->Mindex->checkCoin($this->session->userdata('user_id'));
        
            if($checkCoin != 200)
            {
                redirect('error-pay');
            }    
        }
        
        $this->data['check'] = $this->Mindex->checkUser($this->session->userdata('user_id'));
        $this->data['data'] = $this->Mindex->noteUserDb($this->session->userdata('user_id'));
        
        if(in_array($this->data['getBXH']->bxh, array(null, '', '0')))
        {
            $this->data['getBXH'] = $this->Mindex->getBXH();//echo "<pre>"; die(print_r($this->data['bxh_month']));    
        }
    }
}
